20. String Methods

Methods and Types

What happens when you call a string method like islower() on a float object? For example, 13.37.islower().

There is a playground workspace further down this page that you can use to experiment.

SOLUTION: An error occurs

You can learn more about strings and string methods by looking at the string method documentation.

You will find that the documentation is one of the most valuable resources for writing code, and not only when it comes to strings or writing code in Python! By reading and searching the documentation you can learn about data types and built-in functions as well as how to use them.

Give it a try now! Look up a few string methods (using the link above) and try them out in the programming playground below (using the Test Run button).

String Method Playground

Start Quiz:

# Browse the complete list of string methods at:
# https://docs.python.org/3/library/stdtypes.html#string-methods
# and try them out here

format() Practice

Use the coding space below to practice using the format() string method. There are no right or wrong answers here, just practice!

Start Quiz:

# Write two lines of code below, each assigning a value to a variable


# Now write a print statement using .format() to print out a sentence and the 
#   values of both of the variables